package com.tian.mapper;

import com.tian.dto.user.UserCouponPageReqDto;
import com.tian.dto.user.UserCouponPageRespDto;
import com.tian.entity.ChargeUserCoupon;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

@Mapper
public interface ChargeUserCouponMapper {
    int deleteByPrimaryKey(Long id);

    int insert(ChargeUserCoupon record);

    ChargeUserCoupon selectByPrimaryKey(Long id);

    int updateCouponExpiredAll();
    int countCouponExpiredAll();

    List<ChargeUserCoupon> selectAll();

    List<ChargeUserCoupon> selectByIdList(List<Long> list);
    List<ChargeUserCoupon> selectByCouponIdList(List<Integer> list);

    int updateByPrimaryKey(ChargeUserCoupon record);

    int use(ChargeUserCoupon record);

    int using(@Param("list") List<Long> list, @Param("payOrderId") Long payOrderId);

    int usedByUserId(Long userId);

    int freeByUserId(Long userId);

    List<UserCouponPageRespDto> page(UserCouponPageReqDto userCouponPageReqDto);

    int countTimes(@Param("userId") Long userId, @Param("couponId") Integer couponId);

    int count(Long userId);

    void updateStatus(@Param("userId") Long userId, @Param("status") Integer status,@Param("payOrderId") Long payOrderId,@Param("useTime") Date useTime);

    List<ChargeUserCoupon>  selectByOrderId(Long orderId);

//    int updateUserPoint(@Param("userId") Integer userId, @Param("point")Integer point);
}